#include "level.h"
#include "rect.h"
#include "source.h"
#include "platform.h"
#include "circle.h"
#include "zomby.h"
#include "fx.h"
#include "slope.h"
#include "projectile.h"
#include "kolobok.h"
#include "cloud.h"
#include "respawn.h"
#include "polygon.h"
#include "bird.h"

#include <list>
using namespace std;

Level::Level(){

	sky =NULL;
	rect =NULL;
	finish =NULL;
	src_win =NULL;

	respawns_num =0;
	respawns =NULL;

	platforms =NULL;
	platforms_num =0;
	floors =NULL;
	floors_num =0;
}

Level::~Level(){

	int i;

	delete sky;
	sky =NULL;
	delete rect;
	rect =NULL; 		
	delete src_win;
	src_win =NULL;
	delete finish;
	finish =NULL;

	for(i=0; i<respawns_num; i++){
		delete respawns[i];
		respawns[i] =NULL;
	}
	delete[] respawns;
	respawns =NULL;

	for(i=0; i<platforms_num; i++){
		delete platforms[i];
		platforms[i] =NULL;
	}
	delete[] platforms;
	platforms =NULL;

	for(i=0; i<floors_num; i++){
		delete floors[i];
		floors[i] =NULL;
	}
	delete[] floors;
	floors =NULL;

	while(!zombies.empty()){

		delete zombies.back();
		zombies.pop_back();
	}

	while(!effects.empty()){

		delete effects.back();
		effects.pop_back();
	}

	while(!slopes.empty()){

		delete slopes.back();
		slopes.pop_back();
	}

	while(!slopes2.empty()){

		delete slopes2.back();
		slopes2.pop_back();
	}

	while(!items.empty()){

		delete items.back();
		items.pop_back();
	}

	while(!images.empty()){

		delete images.back();
		images.pop_back();
	}

	while(!circles.empty()){

		delete circles.back();
		circles.pop_back();
	}

	while(!sources.empty()){

		delete sources.back();
		sources.pop_back();
	}

	while(!projectiles.empty()){

		delete projectiles.back();
		projectiles.pop_back();
	}

	while(!koloboks.empty()){

		delete koloboks.back();
		koloboks.pop_back();
	}

	while(!clouds.empty()){

		delete clouds.back();
		clouds.pop_back();
	}

	while(!polygons.empty()){

		delete polygons.back();
		polygons.pop_back();
	}

	while(!birds.empty()){

		delete birds.back();
		birds.pop_back();
	}
}
